<template>
  <header class="mall-header cover">
    <div class="container">
      <div class="logo" @click="backHome">
      </div>
      <div class="user">
        <el-dropdown>
  <span class="el-dropdown-link">
    我的<i class="el-icon-arrow-down el-icon--right"></i>
  </span>
          <el-dropdown-menu slot="dropdown"  >
            <el-dropdown-item v-for="(item, index) in this.$store.state.goodlist">
                <div v-if="item.checked == true">
                    <span>{{item.productName}}</span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <span>{{item.productPrice}}</span> X <span>{{item.productCount}}</span>
                </div>
            </el-dropdown-item>
            <el-button @click="checkOut" style="float: right;font-size: 12px;"  type="text">立即结算</el-button>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </div>
  </header>
</template>

<script lang="ts">
  import { Component, Vue } from 'vue-property-decorator'

  @Component({
    name: 'MallHeader'
  })
  export default class Header extends Vue {
    backHome () {
      this['$router'].push({path: '/'}).catch(() => {})
    }
    checkOut () {

          this['$router'].push({
              path: '/address',
          })
    }
  }
</script>

<style lang="scss" scoped>
@import "../../assets/mixins.scss";

.mall-header {
  height: 5rem;
  background: #fff;

  .container {
    @include flex-container;
    height: 100%;
    justify-content: space-between;

    .logo {
      width: 5rem;
      height: 100%;
      padding: 0.6rem;

      img {
        height: 100%;
      }
    }

    .user {
      display: flex;
      width: 10rem;
      height: 100%;
      padding: 1rem;
      justify-content: center;
      align-items: center;
      font-size: 1rem;
    }
  }
}
</style>